package com.yty.demo._3_grammar;
/**
 * @author: yangtaoyao
 * @time: 2020/1/6 15:24$
 * @description: 数据类型
 */
public class dataTypeTest {
    public static void main(String[] args) {
        byte aByte=1;
        short aShort=2;
        int anInt=3;
        long aLong=10;
        float aFloat=0.1f;//必须声明f
        double aDouble=0.1;
        char aChar=' ';
        boolean aBoolean=true;

        aShort=aByte;
        System.out.println(aShort);
        //0~9 ASCII 48~57
        //A~Z ASCII 65~90
        //a~z ASCII 97~122
        int intchar='A';
        System.out.println(intchar);
        intchar='Z';
        System.out.println(intchar);

        String s="123";
        int i=Integer.parseInt(s);
        Integer.valueOf(s);
        s="2.1";
        float f=Float.parseFloat(s);
        Float.valueOf(s);

        short short1= (short) aLong;
        int int1= (int) aLong;

        System.out.println(getType(aByte+aLong));
        System.out.println(getType(aByte+aByte));
    }
    public static String getType(Object o){ //获取变量类型方法

        return o.getClass().toString(); //使用int类型的getClass()方法

    }
}
